﻿#if UNITY_EDITOR
using System;
/// <summary>
/// 编辑器单例
/// </summary>
public abstract class AbsESF_EditorSingle<T>
        where T : AbsESF_EditorSingle<T>
{
    #region AbsEditorStrayFogSingle 构造函数
    /// <summary>
    /// 构造函数
    /// </summary>
    protected AbsESF_EditorSingle() { }
    #endregion

    #region instance 单例
    /// <summary>
    /// 单例
    /// </summary>
    static T mInstance = null;
    /// <summary>
    /// 单例
    /// </summary>
    public static T instance
    {
        get
        {
            if (mInstance == null)
            {
                mInstance = Activator.CreateInstance<T>();
                mInstance.OnAfterCreateInstance();
            }
            return mInstance;
        }
    }
    #endregion

    #region OnAfterCreateInstance 创建实例后
    /// <summary>
    /// 创建实例后
    /// </summary>
    protected virtual void OnAfterCreateInstance() { }
    #endregion
}
#endif